package conf
import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

const (
	NSQD_ADDRESS_KEY string = "NSQD_ADDRESS"
)

// NsqSection map toml [nsq]
type NsqSection struct {
	NsqLookupds []string `mapstructure:"nsq_lookupds"`
	NsqdAddress string `mapstructure:"nsqd_address"`
}

// ReadNsq get nsq section from config
func ReadNsq (v *viper.Viper, slog *zap.SugaredLogger) (nsqConf NsqSection) {
	err := v.Unmarshal(&nsqConf)
	if err != nil {
		slog.Panicf("unable to decode into nsq section, %v", err)
	}
	slog.Debug(nsqConf)
	return
}